package com.longtop.leaning.midlet;

import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Form;
import javax.microedition.lcdui.List;
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;

import com.longtop.leaning.ui.FlightLoginForm;
import com.longtop.leaning.ui.FlightMenu;
import com.longtop.leaning.ui.FlightQueryForm;

public class FlightMIDlet extends MIDlet {
	private List _flightMenu = null;
	private Form _loginForm = null;
	private Form _queryForm = null;
	private Display _display = null;
	private boolean _firstTime = true;
	
	public FlightMIDlet() {		                   
        if(_firstTime){
        	_display = Display.getDisplay (this);
        }
	}

	protected void destroyApp(boolean arg0){
		// TODO Auto-generated method stub
	}

	protected void pauseApp() {
		// TODO Auto-generated method stub

	}
	protected void startApp() throws MIDletStateChangeException {
		// TODO Auto-generated method stub		
		showLoginForm();
	}
	
	public void destroy(boolean arg0) {
			this.destroyApp(arg0);
	}	
	
	public void showLoginForm(){
		if(_loginForm == null){
			_loginForm = new FlightLoginForm(this);
		}
		_display.setCurrent(_loginForm);
	}
	public void showFlightMenu(){
		if(_flightMenu == null){
			_flightMenu = new FlightMenu(this);
		}
		_display.setCurrent(_flightMenu);
	}	
	public void showFlightQueryForm(){
		if(_queryForm == null){
			_queryForm = new FlightQueryForm(this);
		}
		_display.setCurrent(_queryForm);
		
		
	}		
	
}
